import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userinfo:{
      username:"",
      pwd:""
    },
    tuser:{
      id:"",
      tid:"",
      username:"",
      telephone:"",
      password:"",
      gender:"",
      fullname:"",
      email:"",
      birthday:"",
      familyhistory:"",
      medicalhistory:"",
      allergichistory:""
    }

  },
  getters: {
  },
  mutations: {
    getUsers(state){
      state.userinfo.username=sessionStorage.getItem("user");
      state.userinfo.pwd=sessionStorage.getItem("pwd");
    
    },
    getTusers(state){
      state.tuser.id=sessionStorage.getItem("id");
      state.tuser.tid=sessionStorage.getItem("tid");
      state.tuser.birthday=sessionStorage.getItem("birthday");
      state.tuser.email=sessionStorage.getItem("email");
      state.tuser.fullname=sessionStorage.getItem("fullname");
      state.tuser.gender=sessionStorage.getItem("gender");
      state.tuser.password=sessionStorage.getItem("password");
      state.tuser.telephone=sessionStorage.getItem("telephone");
      state.tuser.username=sessionStorage.getItem("username");
      state.tuser.familyhistory=sessionStorage.getItem("familyhistory");
      state.tuser.medicalhistory=sessionStorage.getItem("medicalhistory");
      state.tuser.allergichistory=sessionStorage.getItem("allergichistory");
    }
  },
  actions: {
  },
  modules: {
  }
})
